package com.qi.sqlSession;

import com.qi.pojo.Configuration;
import com.qi.pojo.Mapper;

import java.util.List;

/**
 * @author zjq
 * @version 1.0
 * @date 2021/12/5 17:11
 */
public class DefaultSqlSeeion implements SqlSession {
    private Configuration configuration;
    private Executer executer = new SimpleExecuter();


    public DefaultSqlSeeion(Configuration configuration) {
        this.configuration = configuration;
    }

    @Override
    public <E> List<E> selectList(String statementid, Object... parm) throws Exception {
        Mapper mapper = configuration.getMapperMap().get(statementid);
        return executer.query(configuration, mapper, parm);
    }
}
